﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace LightSwitchApplication.Web
{
    /// <summary>
    /// Summary description for SendEmail
    /// </summary>
    public class SendEmail : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            string from = context.Request.Form["from"], to = context.Request.Form["to"]
                , subject = context.Request.Form["subject"], body = context.Request.Form["body"];
            //var requestStream = context.Request.InputStream;
            LightSwitchApplication.UserCode.ExchangeHelper.SendEmailExchangeWebService(from, to, subject, body);
            context.Response.ContentType = "text/plain";
            context.Response.Write("Email is sent");
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}